import request from "@/utils/request";
import { PATH_SYS_DNF} from "@/utils/constant";
import {WeaponUp} from "@/api/sys/dnf/weapon-up/types";

const baseUrl = PATH_SYS_DNF + '/weapon-up/'

/**
 * 查询武器增幅列表 - 带分页
 * @param data
 */
export function getWeaponUpListApi(data: PageQuery<WeaponUp>): PromisePageListType<WeaponUp> {
    return request.post(baseUrl + 'list', data)
}

/**
 * 通过武器增幅id获取武器增幅信息
 * @param id
 */
export function getWeaponUpByIdApi(id: number): Promise<WeaponUp> {
    return request.get(baseUrl + id)
}

/**
 * 获得该武器下一个等级,通过weaponType和level
 * @param weaponType
 * @param level
 */
export function getWeaponUpNext(weaponType:number,level:number): Promise<WeaponUp> {
    return request.post(baseUrl + 'next',{weaponType,level})
}

/**
 * 修改武器增幅
 * @param id
 * @param data
 */
export function editWeaponUpApi(id:number,data: WeaponUp): Promise<any> {
    return request.patch(baseUrl+id, data)

}

/**
 * 添加武器增幅
 * @param data
 */
export function addWeaponUpApi(data: WeaponUp): Promise<any> {
    return request.post(baseUrl, data)
}

/**
 * 删除武器增幅
 * @param id
 */
export function deleteWeaponUpApi(id: number): Promise<any> {
    return request.delete(baseUrl + id)
}